<template>
  <div class="home">
    {{this.$store.state.num}}
    <div>
      <button @click="add">+</button>
      <button @click="reduce">-</button>
    </div>
     <div>
      <button @click="addTime">2s后+</button>
      <button @click="reduceTime">2s后-</button>
    </div>
    <HelloWorld msg="Welcome to Your Vue.js App"/>
  </div>
</template>

<script>
// @ is an alias to /src
import HelloWorld from '@/components/HelloWorld.vue'

export default {
  name: 'HomeView',
  components: {
    HelloWorld
  },
  methods:{
    add(){
      this.$store.commit('add')
    },
    reduce(){
      this.$store.commit('reduce')
    },
    addTime(){
      this.$store.dispatch('timeAdd')
    },
    reduceTime(){
      this.$store.dispatch('timeReduce')
    }
  }
}
</script>
